<mk-drawer-form
    v-model="drawer"
    :loading="drawerLoading"
    :title="typeof drawerData.id === 'undefined' ? '添加' : '编辑'"
    @save="saveDrawer()">
    <el-form
        :model="drawerData" 
        ref="drawerData" 
        :rules="drawerRules" 
        label-width="120px">
        <el-form-item label="昵称：" prop="nickname">
            <el-input v-model="drawerData.nickname" placeholder="请输入管理员昵称" maxlength="40" show-word-limit></el-input>
        </el-form-item>
        <el-form-item label="组别：" prop="group_id">
            <el-select v-model="drawerData.group_id" filterable placeholder="输入文字可搜索组别">
                <el-option
                    v-for="(item, index) in group"
                    :key="index"
                    :label="item.title"
                    :value="item.id">
                    <span v-html="item.treeString" class="mk-tree-name"></span>
                    {{ item.title }}
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="性别：" prop="sex">
            <el-select v-model="drawerData.sex" placeholder="请选择管理员性别">
                <el-option
                    v-for="(item, index) in sexOption"
                    :key="index"
                    :label="item.title"
                    :value="item.value">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="邮箱：" prop="email">
            <el-input 
                v-model="drawerData.email" 
                placeholder="请输入管理员邮箱"
                :disabled="typeof drawerData.id !== 'undefined'">
            </el-input>
        </el-form-item>
        <el-form-item label="账号：" prop="account">
            <el-input 
                v-model="drawerData.account" 
                placeholder="请输入管理员登录账号" 
                maxlength="40" 
                show-word-limit 
                :disabled="typeof drawerData.id !== 'undefined'">
            </el-input>
        </el-form-item>
        <el-form-item label="密码：" prop="password">
            <el-input 
                v-model="drawerData.password" 
                :placeholder="typeof drawerData.id === 'undefined' ? '请输入管理员登录密码' : '此处留空则为原密码'" 
                show-password>
            </el-input>
        </el-form-item>
        <el-form-item label="头像：" prop="cover">
            <mk-file-select v-model="drawerData.cover"></mk-file-select>
        </el-form-item>
        <el-form-item label="状态：" prop="status">
            <el-switch
                v-model="drawerData.status"
                active-color="#13ce66"
                :active-value="1"
                :inactive-value="0">
            </el-switch>
        </el-form-item>
        <el-form-item label="" label-width="0" prop="field">
            <mk-field v-model="drawerData.field" :ifset="false"></mk-field>
        </el-form-item>
    </el-form>
</mk-drawer-form>